package com.yiip.gmall.manager.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yiip.gmall.beans.PmsBaseSaleAttr;
import com.yiip.gmall.beans.PmsProductInfo;
import com.yiip.gmall.service.ProductService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@CrossOrigin
public class SpuController {

    @Reference
    ProductService productService;

    @RequestMapping("/spuList")
    @ResponseBody
    public List<PmsProductInfo> spuList(String catalog3Id) {
        List<PmsProductInfo> pmsProductInfoList = productService.spuList(catalog3Id);
        return pmsProductInfoList;
    }

    @RequestMapping("/baseSaleAttrList")
    @ResponseBody
    public List<PmsBaseSaleAttr> baseSaleAttrList() {
        List<PmsBaseSaleAttr> pmsBaseSaleAttrList = productService.baseSaleAttrList();
        return pmsBaseSaleAttrList;
    }

    @RequestMapping("/saveSpuInfo")
    @ResponseBody
    public void saveSpuInfo(@RequestBody PmsProductInfo pmsProductInfo) {
       //productService.saveSpuInfo();
    }
}
